package com.copm.ifm.servers.sys.mq.redis;

import com.copm.ifm.base.basic.pojo.SysExceptionLog;
import com.copm.ifm.servers.sys.service.SysExceptionLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.stream.ObjectRecord;
import org.springframework.data.redis.stream.StreamListener;
import org.springframework.stereotype.Component;

/**
 * 短信发送流消息监听器
 *
 * @author zzf
 * @date 2021/3/9 16:35
 */
@Slf4j
@Component
public class ExceptionLogStreamConsumer implements StreamListener<String, ObjectRecord<String, SysExceptionLog>> {

    @Autowired
    SysExceptionLogService exceptionLogService;

    @Override
    public void onMessage(ObjectRecord<String, SysExceptionLog> record) {
        exceptionLogService.save(record.getValue());
    }
}
